
<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>新增地址</title>
		<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
		<!-- 引入样式 -->
		<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/vant@1.6/lib/index.css">
		<link rel="stylesheet" href="../css/main.css">
		<!-- 引入组件 -->
		<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.min.js"></script>
		<script src="https://cdn.jsdelivr.net/npm/vant@1.6/lib/vant.min.js"></script>
		<script src="html5plus://ready"></script>
		<script src="../../js/ajax.js"></script>
		<script type="text/javascript" src="../../js/fanhui.js" ></script>
	</head>
	<body>
		<div id="app">
			<header>
			<van-nav-bar @click-left="onClickLeft" style="background-color: red;">
					<van-icon slot="left" name="arrow-left" color="white"></van-icon>
					<label slot="title" style="color: white;">收货地址</label>
				</van-nav-bar>
			</header>
			<section>
				<van-pull-refresh v-model="isLoading" @refresh="onRefresh">
					<van-address-list
						:list="areaList"
						@add="onClickBigBtn"
						@edit="onEdit"
					></van-address-list>
					</van-pull-refresh>
			</section>
		</div>
	</body>
	<script>
		var vm = new Vue({
			el: "#app",
			data: {
				areaList:[],
				finished: false,
					isLoading: false
			},
			methods: {
				onRefresh: function() {						
						setTimeout(() => {
							this.$toast('刷新成功');
							this.isLoading = false;
						}, 500);
					},
				onClickBigBtn() {//点击添加的时候发生的事件
					var addview=plus.webview.create("address.html","address");
					plus.webview.close(plus.webview.currentWebview());
					addview.show();
				},
				onEdit()//点击编辑的时候发生的事件
				{
					
				},
				onClickLeft: function() { //返回个人中心
					plus.webview.close(plus.webview.currentWebview(), "slide-out-left");
				}
				
			},
			created:function()
			{
				this.user = JSON.parse(plus.storage.getItem("user"));
				console.log(this.user);
				ajax({//判断这里边有没有收获地址
					url: "http://dsapi.ysd3g.com/API/MyShippingAddressList",
					dataType: "jsonp",
					data: {
						key: this.user.Key
					},
					success: function(res) {
						var sure={
						  id: '',
						  name: '',
						  tel: '',
						  address: ''
						};
						vm.areaList=res.Data;
						console.log(vm.areaList);
					}
				});
			}
		});
	</script>
</html>
